import {SAVE_USER_INFO, DELETE_USER_INFO} from '../action_types.js'

export const createSaveUserInfoAction = value => {
  // 将user及token存入localStorage
  localStorage.setItem('user', JSON.stringify(value.user))
  localStorage.setItem('token', value.token)
  return ({type: SAVE_USER_INFO, data: value})
}

export const createDeleteUserInfoAction = value => {
  // 删除localStorage中的user及token
  localStorage.removeItem('user')
  localStorage.removeItem('token')
  return ({type: DELETE_USER_INFO, data: value})
}
